package com.wfh.yudada.config;

import io.reactivex.Scheduler;
import io.reactivex.schedulers.Schedulers;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;

/**
 * @Author FengHuan Wang
 * @Date 2025/5/24 16:19
 * @Version 1.0
 */
@Configuration
@Data
public class VipSchedulerConfig {

    @Bean
    public Scheduler vipScheduler (){
        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(4, new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r, "vip-scheduler");
                thread.setDaemon(false);
                return thread;
            }
        });
        return Schedulers.from(executorService);
    }
}
